﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using RooHui.Infrastructure.Entities.EFContext;
using RooHui.Infrastructure.Entities.Repository;

namespace RooHui.Infrastructure.Entities.Entity
{
    public class SystemLog : IAccessible<S_SystemLog, SystemLog>, ILogicEntity<S_SystemLog, SystemLog>
    {
        public int ID { get; set; }
        public string OperateUser { get; set; }
        public int MsgType { get; set; }
        public string Message { get; set; }
        public DateTime CreateTime { get; set; }

        protected override void Covariant(S_SystemLog model)
        {
            if (model != null)
            {
                this.CreateTime = model.CreateTime;
                this.ID = model.ID;
                this.Message = model.Message;
                this.MsgType = model.MsgType;
                this.OperateUser = model.OperateUser;
            }
        }

        protected override S_SystemLog Inverter(SystemLog model)
        {
            if (model != null)
            {
                return new S_SystemLog()
                {
                    CreateTime = model.CreateTime,
                    ID = model.ID,
                    Message = model.Message,
                    MsgType = model.MsgType,
                    OperateUser=model.OperateUser
                };
            }
            return null;
        }

        public SystemLog Set(S_SystemLog dbModel)
        {
            Covariant(dbModel);
            return this;
        }
    }
}
